package
{
	import root.TestRoot;
	
	public class TestXML2 extends TestRoot
	{
		public function TestXML2()
		{
			super();
			var foodgroup:XML=<foodgroup>
				<fruits>
					<fruit color="red">Apple</fruit>
					<fruit color="orange">Orange</fruit>
					<fruit color="green">Pear</fruit>
					<fruit color="red">Watermelon</fruit>
					<servings>3</servings>
				</fruits>
				<servings>10</servings>
				<vegetables>
					<vegetable color="red">Tomato</vegetable>
					<vegetable color="brown">Potato</vegetable>
					<vegetable color="green">Broccoli</vegetable>
					<servings>2</servings>
				</vegetables>
			</foodgroup>;
			//var list:XMLList = foodgroup..servings;
			//var list:XMLList = foodgroup.*.servings;
			var list:XMLList = foodgroup..*.(hasOwnProperty("@color") && @color=="red");			
		//	walk(list);
			
			list = foodgroup.fruits.(fruit=="Orange");
			//trace(attr);
			walk(list);
			
			var test:XML = <root>
								<svr><![CDATA[ <a href='http://www.game300.net'>click me</a> ]]></svr>
						   </root>;
			trace(test.svr);
			
			var test2:XML = <doc><![CDATA[a<b]]></doc>;
			trace(test2);
		}
		
		public	function	walk(list:XMLList):void{
			for each(var elem:XML in list){
				trace(elem);
			}
		}
	}
}